# -*- encoding: utf-8 -*-
# @File    :   __init__.py
# @Time    :   2021/07/22 14:57:30
# @Author  :   wudongmin
# @Contact :   wudongmin@xroom.net
# @version   :  1.0

from fastapi import FastAPI
from app.routes import router_article
from fastapi.middleware.cors import CORSMiddleware

def create_app():
    app = FastAPI()
    origins = ["*"]
    app.add_middleware(
        CORSMiddleware,
        allow_origins=origins,
        allow_credentials=True,
        allow_methods=["*"],
        allow_headers=["*"],
    )
    app.include_router(router=router_article, prefix="/api/v1")
    return app
